package dj.model;

import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 * Friend entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "friend", catalog = "")
public class Friend implements java.io.Serializable {

	// Fields

	private String id;
	private Tuser tuser;
	private String groupid;
	private String userid;
	private Set<FriendExtend> friendExtends = new HashSet<FriendExtend>(0);

	// Constructors

	/** default constructor */
	public Friend() {
	}

	/** minimal constructor */
	public Friend(String id, Tuser tuser, String groupid, String userid) {
		this.id = id;
		this.tuser = tuser;
		this.groupid = groupid;
		this.userid = userid;
	}

	/** full constructor */
	public Friend(String id, Tuser tuser, String groupid, String userid, Set<FriendExtend> friendExtends) {
		this.id = id;
		this.tuser = tuser;
		this.groupid = groupid;
		this.userid = userid;
		this.friendExtends = friendExtends;
	}

	// Property accessors
	@Id
	@Column(name = "id", unique = true, nullable = false, length = 36)
	public String getId() {
		return this.id;
	}

	public void setId(String id) {
		this.id = id;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "friendid", nullable = false)
	public Tuser getTuser() {
		return this.tuser;
	}

	public void setTuser(Tuser tuser) {
		this.tuser = tuser;
	}

	@Column(name = "groupid", nullable = false, length = 36)
	public String getGroupid() {
		return this.groupid;
	}

	public void setGroupid(String groupid) {
		this.groupid = groupid;
	}

	@Column(name = "userid", nullable = false, length = 36)
	public String getUserid() {
		return this.userid;
	}

	public void setUserid(String userid) {
		this.userid = userid;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER, mappedBy = "friend")
	public Set<FriendExtend> getFriendExtends() {
		return this.friendExtends;
	}

	public void setFriendExtends(Set<FriendExtend> friendExtends) {
		this.friendExtends = friendExtends;
	}

}